﻿// $Id: ProjectNode.cs 64 2008-05-06 18:29:47Z nvivo $

using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;

namespace DBLGen.GUI
{
	internal class ProjectNode : TreeNode
	{
		public ProjectNode(string text, ProjectNodeType type, object tag, string imageKey, string selectedImageKey)
			: base(text)
		{
			this.Tag = tag;
			this.ImageKey = imageKey;
			this.SelectedImageKey = selectedImageKey;
			this._type = type;
		}

		public ProjectNode(string text, ProjectNodeType type, object tag, string imageKey)
			: this(text, type, tag, imageKey, imageKey)
		{ }

		private ProjectNodeType _type;

		public ProjectNodeType Type
		{
			get
			{
				return _type;
			}
		}

		public bool NeedsRefresh
		{
			get
			{
				return Nodes.Count == 1 && Nodes[0].Text == "Loading...";
			}
		}


		public void PrepareForRefresh()
		{
			this.Nodes.Clear();
			this.Nodes.Add(new TreeNode("Loading..."));
		}
	}
}
